Change in openvpn[master]: options: drop useless init_gc param for init_options()
A message that is not in the archive (sent off-list or not yet received): gerrit.1771283598000.I633d8cbf75ab4da85e16df44684aef60523811c5@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
to review the following change.
Change subject: options: drop useless init_gc param for init_options()
......................................................................
options: drop useless init_gc param for init_options()
The init_option() function is always invoked with the second param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic.
This way we can also drop the options->gc_owned member as it would also be always set to true.
---
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
3 files changed, 12 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/1536/1
src/openvpn/openvpn.c +1 -1
@@ -202,7 +202,7 @@#endif /* initialize options to default state */ -init_options (&c.options, true); +init_options (&c.options);/* parse command line options, and read configuration file */ parse_argv (&c.options, argc, argv,M_USAGE ,OPT_P_DEFAULT ,NULL , c.es);
src/openvpn/options.c +10 -15
@@ -792,15 +792,12 @@* will be set to 0. */ void -init_options (struct options *o,const bool init_gc) +init_options (struct options *o) {CLEAR (*o); -if (init_gc) - { -gc_init (&o->gc); -gc_init (&o->dns_options.gc); - o->gc_owned = true; - } +gc_init (&o->gc); +gc_init (&o->dns_options.gc); + o->mode =MODE_POINT_TO_POINT ; o->topology =TOP_UNDEF ; o->ce.proto =PROTO_UDP ;
@@ -925,11 +922,9 @@ {CLEAR (*o->remote_list); } -if (o->gc_owned) - { -gc_free (&o->gc); -gc_free (&o->dns_options.gc); - } + +gc_free (&o->gc); +gc_free (&o->dns_options.gc); }#ifndef ENABLE_SMALL
@@ -2256,7 +2251,7 @@int dev =DEV_TYPE_UNDEF ;bool pull = false; -init_options (&defaults, true); +init_options (&defaults);if (!options->test_crypto) {
@@ -4824,7 +4819,7 @@#else struct options o; -init_options (&o, true); +init_options (&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
@@ -5979,7 +5974,7 @@struct options sub;struct connection_entry *e; -init_options (&sub, true); +init_options (&sub); sub.ce = options->ce;read_config_string ("[CONNECTION-OPTIONS]" , &sub, p[1 ], msglevel,OPT_P_CONNECTION , option_types_found, es);
src/openvpn/options.h +1 -2
@@ -254,7 +254,6 @@struct options {struct gc_arena gc; -bool gc_owned;/* first config file */ const char *config;
@@ -890,7 +889,7 @@void show_dco_version (const unsigned int flags); -void init_options (struct options *o,const bool init_gc); +void init_options (struct options *o);void uninit_options (struct options *o);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Gerrit-Change-Number: 1536
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
to look at the new patch set (#2).
Change subject: options: drop useless init_gc param for init_options()
......................................................................
options: drop useless init_gc param for init_options()
The init_option() function is always invoked with the second param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic.
This way we can also drop the options->gc_owned member as it would also be always set to true.
---
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M tests/unit_tests/openvpn/test_options_parse.c
4 files changed, 12 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/1536/2
src/openvpn/openvpn.c +1 -1
@@ -202,7 +202,7 @@#endif /* initialize options to default state */ -init_options (&c.options, true); +init_options (&c.options);/* parse command line options, and read configuration file */ parse_argv (&c.options, argc, argv,M_USAGE ,OPT_P_DEFAULT ,NULL , c.es);
src/openvpn/options.c +10 -15
@@ -792,15 +792,12 @@* will be set to 0. */ void -init_options (struct options *o,const bool init_gc) +init_options (struct options *o) {CLEAR (*o); -if (init_gc) - { -gc_init (&o->gc); -gc_init (&o->dns_options.gc); - o->gc_owned = true; - } +gc_init (&o->gc); +gc_init (&o->dns_options.gc); + o->mode =MODE_POINT_TO_POINT ; o->topology =TOP_UNDEF ; o->ce.proto =PROTO_UDP ;
@@ -925,11 +922,9 @@ {CLEAR (*o->remote_list); } -if (o->gc_owned) - { -gc_free (&o->gc); -gc_free (&o->dns_options.gc); - } + +gc_free (&o->gc); +gc_free (&o->dns_options.gc); }#ifndef ENABLE_SMALL
@@ -2256,7 +2251,7 @@int dev =DEV_TYPE_UNDEF ;bool pull = false; -init_options (&defaults, true); +init_options (&defaults);if (!options->test_crypto) {
@@ -4824,7 +4819,7 @@#else struct options o; -init_options (&o, true); +init_options (&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
@@ -5979,7 +5974,7 @@struct options sub;struct connection_entry *e; -init_options (&sub, true); +init_options (&sub); sub.ce = options->ce;read_config_string ("[CONNECTION-OPTIONS]" , &sub, p[1 ], msglevel,OPT_P_CONNECTION , option_types_found, es);
src/openvpn/options.h +1 -2
@@ -254,7 +254,6 @@struct options {struct gc_arena gc; -bool gc_owned;/* first config file */ const char *config;
@@ -890,7 +889,7 @@void show_dco_version (const unsigned int flags); -void init_options (struct options *o,const bool init_gc); +void init_options (struct options *o);void uninit_options (struct options *o);
tests/unit_tests/openvpn/test_options_parse.c +0 -1
@@ -248,7 +248,6 @@CLEAR (o);/* NB: avoiding init_options to limit dependencies */ gc_init (&o.gc);gc_init (&o.dns_options.gc); - o.gc_owned = true;char *p_expect_someopt[MAX_PARMS ];char *p_expect_otheropt[MAX_PARMS ];
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Gerrit-Change-Number: 1536
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: ordex, plaisthos.
flichtenheld has posted comments on this change by ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email )
Change subject: options: drop useless init_gc param for init_options()
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Gerrit-Change-Number: 1536
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Feb 2026 13:54:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v2 1/1 options: drop useless init_gc param for init_options()
In reply to a message not in the archiveFrom: Antonio Quartulli <[email protected]...>
The init_option() function is always invoked with the second param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic.
This way we can also drop the options->gc_owned member as it would also be always set to true.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/openvpn.c +1 -1
@@ -202,7 +202,7 @@#endif /* initialize options to default state */ -init_options (&c.options, true); +init_options (&c.options);/* parse command line options, and read configuration file */ parse_argv (&c.options, argc, argv,M_USAGE ,OPT_P_DEFAULT ,NULL , c.es);
src/openvpn/options.c +10 -15
@@ -792,15 +792,12 @@* will be set to 0. */ void -init_options (struct options *o,const bool init_gc) +init_options (struct options *o) {CLEAR (*o); -if (init_gc) - { -gc_init (&o->gc); -gc_init (&o->dns_options.gc); - o->gc_owned = true; - } +gc_init (&o->gc); +gc_init (&o->dns_options.gc); + o->mode =MODE_POINT_TO_POINT ; o->topology =TOP_UNDEF ; o->ce.proto =PROTO_UDP ;
@@ -925,11 +922,9 @@ {CLEAR (*o->remote_list); } -if (o->gc_owned) - { -gc_free (&o->gc); -gc_free (&o->dns_options.gc); - } + +gc_free (&o->gc); +gc_free (&o->dns_options.gc); }#ifndef ENABLE_SMALL
@@ -2256,7 +2251,7 @@int dev =DEV_TYPE_UNDEF ;bool pull = false; -init_options (&defaults, true); +init_options (&defaults);if (!options->test_crypto) {
@@ -4824,7 +4819,7 @@#else struct options o; -init_options (&o, true); +init_options (&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
@@ -5979,7 +5974,7 @@struct options sub;struct connection_entry *e; -init_options (&sub, true); +init_options (&sub); sub.ce = options->ce;read_config_string ("[CONNECTION-OPTIONS]" , &sub, p[1 ], msglevel,OPT_P_CONNECTION , option_types_found, es);
src/openvpn/options.h +1 -2
@@ -254,7 +254,6 @@struct options {struct gc_arena gc; -bool gc_owned;/* first config file */ const char *config;
@@ -890,7 +889,7 @@void show_dco_version (const unsigned int flags); -void init_options (struct options *o,const bool init_gc); +void init_options (struct options *o);void uninit_options (struct options *o);
tests/unit_tests/openvpn/test_options_parse.c +0 -1
@@ -248,7 +248,6 @@CLEAR (o);/* NB: avoiding init_options to limit dependencies */ gc_init (&o.gc);gc_init (&o.dns_options.gc); - o.gc_owned = true;char *p_expect_someopt[MAX_PARMS ];char *p_expect_otheropt[MAX_PARMS ];
[Openvpn-devel] [PATCH applied] Re: options: drop useless init_gc param for init_options()
Well spotted... on the first glance, this was like "uh, would that be safe? what if anything else relies on gc_owned?", but on more thorough reading it's really as you say - all callers pass "true", and this field is not used anywhere ever again ("confirmed by grep and buildbot" ;-) ).
Your patch has been applied to the master and release/2.7 branch (prerequisite for a subsequent bugfix).
commit 92937c267b20e3e1ffd4e0e80d8048a57da7edb6 (master) commit acbe874c71444afffa2238a0b8b45d330b78f86c (release/2.7)
Author: Antonio Quartulli Date: Tue Feb 17 14:56:05 2026 +0100
options: drop useless init_gc param for init_options()
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35695.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: options: drop useless init_gc param for init_options()
......................................................................
options: drop useless init_gc param for init_options()
The init_option() function is always invoked with the second param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic.
This way we can also drop the options->gc_owned member as it would also be always set to true.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35695.html
---
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M tests/unit_tests/openvpn/test_options_parse.c
4 files changed, 12 insertions(+), 19 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/1536/3
src/openvpn/openvpn.c +1 -1
@@ -202,7 +202,7 @@#endif /* initialize options to default state */ -init_options (&c.options, true); +init_options (&c.options);/* parse command line options, and read configuration file */ parse_argv (&c.options, argc, argv,M_USAGE ,OPT_P_DEFAULT ,NULL , c.es);
src/openvpn/options.c +10 -15
@@ -792,15 +792,12 @@* will be set to 0. */ void -init_options (struct options *o,const bool init_gc) +init_options (struct options *o) {CLEAR (*o); -if (init_gc) - { -gc_init (&o->gc); -gc_init (&o->dns_options.gc); - o->gc_owned = true; - } +gc_init (&o->gc); +gc_init (&o->dns_options.gc); + o->mode =MODE_POINT_TO_POINT ; o->topology =TOP_UNDEF ; o->ce.proto =PROTO_UDP ;
@@ -925,11 +922,9 @@ {CLEAR (*o->remote_list); } -if (o->gc_owned) - { -gc_free (&o->gc); -gc_free (&o->dns_options.gc); - } + +gc_free (&o->gc); +gc_free (&o->dns_options.gc); }#ifndef ENABLE_SMALL
@@ -2256,7 +2251,7 @@int dev =DEV_TYPE_UNDEF ;bool pull = false; -init_options (&defaults, true); +init_options (&defaults);if (!options->test_crypto) {
@@ -4824,7 +4819,7 @@#else struct options o; -init_options (&o, true); +init_options (&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
@@ -5979,7 +5974,7 @@struct options sub;struct connection_entry *e; -init_options (&sub, true); +init_options (&sub); sub.ce = options->ce;read_config_string ("[CONNECTION-OPTIONS]" , &sub, p[1 ], msglevel,OPT_P_CONNECTION , option_types_found, es);
src/openvpn/options.h +1 -2
@@ -254,7 +254,6 @@struct options {struct gc_arena gc; -bool gc_owned;/* first config file */ const char *config;
@@ -890,7 +889,7 @@void show_dco_version (const unsigned int flags); -void init_options (struct options *o,const bool init_gc); +void init_options (struct options *o);void uninit_options (struct options *o);
tests/unit_tests/openvpn/test_options_parse.c +0 -1
@@ -248,7 +248,6 @@CLEAR (o);/* NB: avoiding init_options to limit dependencies */ gc_init (&o.gc);gc_init (&o.dns_options.gc); - o.gc_owned = true;char *p_expect_someopt[MAX_PARMS ];char *p_expect_otheropt[MAX_PARMS ];
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Gerrit-Change-Number: 1536
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email )
Change subject: options: drop useless init_gc param for init_options()
......................................................................
options: drop useless init_gc param for init_options()
The init_option() function is always invoked with the second param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed while always taking the "true" branch in the related logic.
This way we can also drop the options->gc_owned member as it would also be always set to true.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35695.html
---
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M tests/unit_tests/openvpn/test_options_parse.c
4 files changed, 12 insertions(+), 19 deletions(-)
src/openvpn/openvpn.c +1 -1
@@ -202,7 +202,7 @@#endif /* initialize options to default state */ -init_options (&c.options, true); +init_options (&c.options);/* parse command line options, and read configuration file */ parse_argv (&c.options, argc, argv,M_USAGE ,OPT_P_DEFAULT ,NULL , c.es);
src/openvpn/options.c +10 -15
@@ -792,15 +792,12 @@* will be set to 0. */ void -init_options (struct options *o,const bool init_gc) +init_options (struct options *o) {CLEAR (*o); -if (init_gc) - { -gc_init (&o->gc); -gc_init (&o->dns_options.gc); - o->gc_owned = true; - } +gc_init (&o->gc); +gc_init (&o->dns_options.gc); + o->mode =MODE_POINT_TO_POINT ; o->topology =TOP_UNDEF ; o->ce.proto =PROTO_UDP ;
@@ -925,11 +922,9 @@ {CLEAR (*o->remote_list); } -if (o->gc_owned) - { -gc_free (&o->gc); -gc_free (&o->dns_options.gc); - } + +gc_free (&o->gc); +gc_free (&o->dns_options.gc); }#ifndef ENABLE_SMALL
@@ -2256,7 +2251,7 @@int dev =DEV_TYPE_UNDEF ;bool pull = false; -init_options (&defaults, true); +init_options (&defaults);if (!options->test_crypto) {
@@ -4824,7 +4819,7 @@#else struct options o; -init_options (&o, true); +init_options (&o); fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds, o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
@@ -5979,7 +5974,7 @@struct options sub;struct connection_entry *e; -init_options (&sub, true); +init_options (&sub); sub.ce = options->ce;read_config_string ("[CONNECTION-OPTIONS]" , &sub, p[1 ], msglevel,OPT_P_CONNECTION , option_types_found, es);
src/openvpn/options.h +1 -2
@@ -254,7 +254,6 @@struct options {struct gc_arena gc; -bool gc_owned;/* first config file */ const char *config;
@@ -890,7 +889,7 @@void show_dco_version (const unsigned int flags); -void init_options (struct options *o,const bool init_gc); +void init_options (struct options *o);void uninit_options (struct options *o);
tests/unit_tests/openvpn/test_options_parse.c +0 -1
@@ -248,7 +248,6 @@CLEAR (o);/* NB: avoiding init_options to limit dependencies */ gc_init (&o.gc);gc_init (&o.dns_options.gc); - o.gc_owned = true;char *p_expect_someopt[MAX_PARMS ];char *p_expect_otheropt[MAX_PARMS ];
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1536?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Gerrit-Change-Number: 1536
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>